package com.huiquan.section.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.section.domain.SectionDnnDisable;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class SectionDnnDisableDao extends EnhancedBaseDao<SectionDnnDisable> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "SECTION_DNN_DISABLE.";

	public SectionDnnDisableDao() {
		super(space);
	}

	public int retrieveSize(Map<String, Object> param) {
		return (Integer) this.object(space + "RETRIEVE_SIZE", param, sqlMapClient);
	}

	@SuppressWarnings("unchecked")
	public List<SectionDnnDisable> retrievesList(Map<String, Object> param) {
		return (List<SectionDnnDisable>) this.list(space + "RETRIEVE_LIST", param, sqlMapClient);
	}

	public void updateDisableById(String id, String disable, String uid) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		param.put("disable", disable);
		param.put("uid", uid);
		this.update(space + "UPDATE_DISABLE_BY_ID", param, sqlMapClient);
	}

	public void updateAscrptionSection(String id, String ascrptionSection, String uid) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		param.put("ascrptionSection", ascrptionSection);
		param.put("uid", uid);
		this.update(space + "UPDATE_ASCRPTION_SECTION_BY_ID", param, sqlMapClient);
	}

	public void updateCheckFlag(String id, String uid) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		param.put("uid", uid);
		this.update(space + "UPDATE_CHECK_FLAG", param, sqlMapClient);
	}

	public void deleteAll() {
		this.update(space + "DELETE_ALL", sqlMapClient);
	}

	public void batchInsert(List<SectionDnnDisable> labelList) {
		this.insert(space + "BATCH_INSERT", labelList, sqlMapClient);
	}
}
